package basic;

public class Errore {

	/** The type. */
	private String type = "";

	/** The error string. */
	private String str = "";

	/** If we can export svg file, this parameter is set to true */
	private boolean cangetsvg = true;

	/** If we can export sql file, this parameter is set to true */
	private boolean cangetsql = true;

	/** The line. */
	private int line = 0;

	/** The column. */
	private int column = 0;

	/**
	 * Instantiates a new error classe.
	 * 
	 * @param type
	 *            the type
	 * @param str
	 *            the error string
	 * @param cangetsvg
	 *            the cangetsvg parameter
	 * @param cangetsql
	 *            the cangetsql parameter
	 * @param line
	 *            the line
	 * @param column
	 *            the column
	 */
	public Errore(String type, String str, boolean cangetsvg,
			boolean cangetsql, int line, int column) {
		if (line > 0 && column > 0) {
			str = "alla linea " + line + ", alla colonna " + column + "; "
			+ str;
		}
		str = str.replaceAll("\n", " ");

		this.type = type;
		this.str = str;
		this.cangetsvg = cangetsvg;
		this.cangetsql = cangetsql;
		this.line = line;
		this.column = column;
	}

	/**
	 * Gets the type.
	 * 
	 * @return the type
	 */
	public String getType() {
		return type;
	}

	/**
	 * Gets the string.
	 * 
	 * @return the string
	 */
	public String getStr() {
		return str;
	}

	/**
	 * Sets the type.
	 * 
	 * @param type
	 *            the new type
	 */
	public void setType(String type) {
		this.type = type;
	}

	/**
	 * Sets the string .
	 * 
	 * @param str
	 *            the new string
	 */
	public void setStr(String str) {
		this.str = str;
	}

	/**
	 * Gets the can get svg.
	 * 
	 * @return the can get svg
	 */
	public boolean getCanGetSvg() {
		return this.cangetsvg;
	}

	/**
	 * Sets the can get svg.
	 * 
	 * @param cangetsvg
	 *            the new can get svg
	 */
	public void setCanGetSvg(boolean cangetsvg) {
		this.cangetsvg = cangetsvg;
	}

	/**
	 * Gets the can get sql.
	 * 
	 * @return the can get sql
	 */
	public boolean getCanGetSql() {
		return this.cangetsql;
	}

	/**
	 * Sets the can get sql.
	 * 
	 * @param cangetsql
	 *            the new can get sql
	 */
	public void setCanGetSql(boolean cangetsql) {
		this.cangetsql = cangetsql;
	}

	/**
	 * Sets the line.
	 * 
	 * @param line
	 *            the new line
	 */
	public void setLine(int line) {
		this.line = line;
	}

	/**
	 * Sets the column.
	 * 
	 * @param column
	 *            the new column
	 */
	public void setColumn(int column) {
		this.column = column;
	}

	/**
	 * Gets the line.
	 * 
	 * @return the line
	 */
	public int getLine() {
		return this.line;
	}

	/**
	 * Gets the column.
	 * 
	 * @return the column
	 */
	public int getColumn() {
		return this.column;
	}

	/**
	 * Checks if is greater than.
	 * 
	 * @param err
	 *            the err
	 * @return true, if is greater than
	 */
	public boolean isGreaterThan(Errore err) {
		return (this.line > err.line || (this.line == err.line && this.column >= err.column));
	}
}
